var t = getApp();

Page({
    data: {
        isReady: !1,
        service_id: 0,
        url: "",
        json: {},
        sureUrl: "",
        info: {},
        appointmentLang: {},
        options: {},
        clicktag: 0
    },
    onLoad: function(t) {
        t.tag && (this.data.tag = t.tag), t.service_id && (this.data.service_id = t.service_id);
        var a = decodeURIComponent(t.scene);
        if (a) {
            var e = [];
            e = a.split("&");
            for (var i = 0; i < e.length; i++) {
                var n;
                "service_id" == (n = e[i].split("="))[0] && (this.data.service_id = n[1]), "tag" == n[0] && (this.data.tag = n[1]);
            }
        }
        this.setData({
            appointmentLang: wx.getStorageSync("yz_basic_info").lang.appointment
        }), this.data.isReady = !1, "pro" === this.data.tag ? (this.data.url = "plugin.appointment.frontend.appointment-order.close-service-info", 
        this.data.sureUrl = "plugin.appointment.frontend.appointment-order.close-service", 
        this.data.json = {
            order_id: this.data.service_id
        }) : (this.data.url = "plugin.appointment.frontend.appointment-service.close-service-info", 
        this.data.sureUrl = "plugin.appointment.frontend.appointment-service.close-service", 
        this.data.json = {
            service_id: this.data.service_id
        }), this.getData();
    },
    onReady: function() {},
    getData: function() {
        var a = this, e = t.getNetAddresss(this.data.url);
        t._getNetWork({
            url: e,
            data: this.data.json,
            success: function(t) {
                var e = t.data;
                if (1 !== e.result) return a.tips(e.msg);
                a.setData({
                    isReady: !0,
                    info: e.data
                });
            }
        });
    },
    Sure: function() {
        var a = this;
        if (0 === this.data.clicktag) {
            this.data.clicktag = 1;
            var e = t.getNetAddresss(this.data.sureUrl);
            t._postNetWork({
                url: e,
                data: this.data.json,
                success: function(t) {
                    var e = t.data;
                    if (a.data.clicktag = 0, 1 !== e.result) return a.tips(e.msg);
                    wx.showModal({
                        title: "提示",
                        content: e.msg,
                        showCancel: !1,
                        success: function(t) {
                            t.confirm && ("pro" === a.data.tag ? wx.navigateTo({
                                url: "/packageE/appointment/client/project/project"
                            }) : wx.navigateTo({
                                url: "/packageE/appointment/appointment_index"
                            }), console.log("用户点击确定"));
                        }
                    });
                },
                fail: function(t) {
                    this.data.clicktag = 0, console.log(t);
                }
            });
        }
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    tips: function(t) {
        return wx.showToast({
            title: t,
            icon: "none",
            duration: 2e3
        }), !1;
    }
});